//
//  VCAnimatedView.m
//  wbcomicRN
//
//  Created by OeverYouthful on 25/5/18.
//  Copyright © 2018年 Facebook. All rights reserved.
//

#import "VCAnimatedView.h"

@implementation VCAnimatedView

+ (NSArray *) animationImages {
  NSMutableArray *arr = [NSMutableArray new];
  for (int i=1; i < 16; i++) {
    [arr addObject: [UIImage imageNamed:[NSString stringWithFormat:@"loading_%d", i]]];
  }
  return arr;
}

+ (VCAnimatedView *)animatedView {
      VCAnimatedView *imageView = [[VCAnimatedView alloc] initWithImage:[UIImage imageNamed:@"loading_15"]];
      imageView.animated = NO;
      imageView.animationImages = [VCAnimatedView animationImages];
      imageView.animationDuration = 1;
      imageView.animationRepeatCount = 0;
      imageView.clipsToBounds = YES;
      imageView.image = [UIImage imageNamed:@"loading_15"];
      return imageView;
}

- (BOOL)isAnimating {
  return [super isAnimating];
}

- (void)setAnimated:(BOOL)animated {
    _animated = animated;
    if (animated) {
        [self startAnimating];
    } else {
      [self stopAnimating];
    }
}


@end
